package com.weirong.smartvault.backservice.entity_model;

import com.weirong.smartvault.backservice.util.common.ReflectTool;

import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;

/**
 * 于2017/12/11由 KFEB4 创建 .
 */
public class ListModel {
    ListModelInterface list;
    public ListModel(Object list){
        this.list = (ListModelInterface)list;
    }

    public List<String> getKeyNames(){
        return list.keyNames();
    }
    public List<Object> getValues() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
        List res = new ArrayList();
        for(String key:list.keys()){
            res.add(ReflectTool.runMethod(list,key));
        }
        return res;
    }
    public Integer getId(){
        return list.getId();
    }
}
